# encoding: utf-8
# @project: st2111 
# @file: 07_request_timeout.py
# @time: 2023/3/30 15:23
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc:
from urllib.request import urlopen
from urllib.error import HTTPError, URLError

if __name__ == "__main__":
    url = "https://httpbin.org/get"

    try:
        resp = urlopen(url=url, timeout=0)
        content = resp.read()
        result = content.decode("utf-8")
        print(result)

    except HTTPError as http_error:
        print(http_error)

    except URLError as url_error:
        print(url_error)

    except Exception as error:
        print(error)
